<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<meta name="keywords" content="Nacos,Docker" />
	<meta name="description" content="Quick Start for Nacos Docker" />
	<!-- 网页标签标题 -->
	<title>Quick Start for Nacos Docker</title>
	<link rel="shortcut icon" href="https://img.alicdn.com/tfs/TB1hgJpHAPoK1RjSZKbXXX1IXXa-64-64.png"/>
	<link rel="stylesheet" href="/build/documentation.css" />
</head>
<body>
	<div id="root"><div class="documentation-page" data-reactroot=""><header class="header-container header-container-normal"><div class="header-body"><a href="/en-us/index.html"><img class="logo" src="/img/nacos_colorful.png"/></a><div class="search search-normal"><span class="icon-search"></span></div><span class="language-switch language-switch-normal">中</span><div class="header-menu"><img class="header-menu-toggle" src="/img/menu_gray.png"/><ul><li class="menu-item menu-item-normal"><a href="/en-us/index.html">HOME</a></li><li class="menu-item menu-item-normal menu-item-normal-active"><a href="/en-us/docs/quick-start.html">DOCS</a></li><li class="menu-item menu-item-normal"><a href="/en-us/blog">BLOG</a></li><li class="menu-item menu-item-normal"><a href="/en-us/community">COMMUNITY</a></li><li class="menu-item menu-item-normal"><a href="https://cn.aliyun.com/product/aliware/mse?spm=nacos-website.topbar.0.0.0">NACOS IN CLOUD</a><img class="menu-img" src="https://img.alicdn.com/tfs/TB1esl_m.T1gK0jSZFrXXcNCXXa-200-200.png"/></li><li class="menu-item menu-item-normal"><a href="http://console.nacos.io/nacos/index.html">DEMO-CONSOLE</a></li></ul></div></div></header><div class="bar"><div class="bar-body"><img src="/img/docs.png" class="front-img"/><div class="bar-title"><span>Documentation</span><div class="bone bone-light"></div></div><img src="/img/docs.png" class="back-img"/></div></div><section class="content-section"><div class="content-body"><div class="sidemenu"><div class="sidemenu-toggle"><img src="https://img.alicdn.com/tfs/TB1E6apXHGYBuNjy0FoXXciBFXa-200-200.png"/></div><ul><li class="menu-item menu-item-level-1"><span>Nacos </span><ul><li style="height:180px;overflow:hidden" class="menu-item menu-item-level-2"><span>What is Nacos<img style="transform:rotate(0deg)" class="menu-toggle" src="/img/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/what-is-nacos.html" target="_self">What is Nacos</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/concepts.html" target="_self">Concepts</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/architecture.html" target="_self">Architecure</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/feature-list.html" target="_self">Feature list</a></li></ul></li><li style="height:324px;overflow:hidden" class="menu-item menu-item-level-2"><span>Quick Start<img style="transform:rotate(0deg)" class="menu-toggle" src="/img/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/quick-start.html" target="_self">Nacos</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/quick-start-spring.html" target="_self">Nacos Spring</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/quick-start-spring-boot.html" target="_self">Nacos Spring Boot</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/quick-start-spring-cloud.html" target="_self">Nacos Spring Cloud</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/quick-start-docker.html" target="_self">Nacos Docker</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/use-nacos-with-dubbo.html" target="_self">Nacos with Dubbo</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/use-nacos-with-kubernetes.html" target="_self">Nacos with K8s</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/nacos-sync.html" target="_self">Nacos Sync</a></li></ul></li><li style="height:252px;overflow:hidden" class="menu-item menu-item-level-2"><span>User Guide<img style="transform:rotate(0deg)" class="menu-toggle" src="/img/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/sdk.html" target="_self">Java SDK</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/other-language.html" target="_self">Other Language</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/open-api.html" target="_self">Open-API</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/nacos-spring.html" target="_self">Nacos Spring</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/system-configurations.html" target="_self">Nacos System Configurations</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/faq.html" target="_self">FAQ</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>Admin Guide<img style="transform:rotate(-90deg)" class="menu-toggle" src="/img/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/deployment.html" target="_self">Deployment Guide</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/cluster-mode-quick-start.html" target="_self">Cluster Mode Deployment</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/management-api.html" target="_self">Management OpenAPI</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/console-guide.html" target="_self">Admin Console Guide</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/monitor-guide.html" target="_self">Nacos Monitor Guide</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/nacos-config-benchmark.html" target="_self">Nacos Config Benchmark</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/nacos-naming-benchmark.html" target="_self">Nacos Naming Benchmark</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/nacos-sync-use.html" target="_self">Data Migration to Nacos</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>Contributor Guide<img style="transform:rotate(-90deg)" class="menu-toggle" src="/img/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/contributing.html" target="_self">Contribute to Nacos</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/contributing-flow.html" target="_self">Contributing Flow</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/pull-request.html" target="_self">Pull Request Template</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/how-to-reporting-bugs.html" target="_self">How to report bugs</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>Community<img style="transform:rotate(-90deg)" class="menu-toggle" src="/img/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/community.html" target="_self">Community</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/nacos-dev.html" target="_self">Develop Team</a></li></ul></li></ul></li></ul></div><div class="doc-content markdown-body"><h1>Quick Start for Nacos Docker</h1>
<h2>Steps</h2>
<p>Run the following command：</p>
<ul>
<li>
<p>Clone project</p>
<pre><code class="language-powershell">git clone https://github.com/nacos<span class="hljs-literal">-group</span>/nacos<span class="hljs-literal">-docker</span>.git
cd nacos<span class="hljs-literal">-docker</span>
</code></pre>
</li>
<li>
<p>Stand-alone Derby</p>
<pre><code class="language-powershell">docker<span class="hljs-literal">-compose</span> <span class="hljs-operator">-f</span> example/standalone<span class="hljs-literal">-derby</span>.yaml up
</code></pre>
</li>
<li>
<p>Stand-alone Mysql</p>
<pre><code class="language-powershell">docker<span class="hljs-literal">-compose</span> <span class="hljs-operator">-f</span> example/standalone<span class="hljs-literal">-mysql</span>.yaml up
</code></pre>
</li>
<li>
<p>Cluster</p>
<pre><code class="language-powershell">docker<span class="hljs-literal">-compose</span> <span class="hljs-operator">-f</span> example/cluster<span class="hljs-literal">-hostname</span>.yaml up 
</code></pre>
</li>
<li>
<p>Service registration</p>
<pre><code class="language-powershell">curl <span class="hljs-literal">-X</span> POST <span class="hljs-string">'http://127.0.0.1:8848/nacos/v1/ns/instance?serviceName=nacos.naming.serviceName&amp;ip=20.18.7.10&amp;port=8080'</span>
</code></pre>
</li>
<li>
<p>Service discovery</p>
<pre><code class="language-powershell">curl <span class="hljs-literal">-X</span> GET <span class="hljs-string">'http://127.0.0.1:8848/nacos/v1/ns/instance/list?serviceName=nacos.naming.serviceName'</span>
</code></pre>
</li>
<li>
<p>Publish config</p>
<pre><code class="language-powershell">curl <span class="hljs-literal">-X</span> POST <span class="hljs-string">"http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&amp;group=test&amp;content=helloWorld"</span>
</code></pre>
</li>
<li>
<p>Get config</p>
<pre><code class="language-powershell">  curl <span class="hljs-literal">-X</span> GET <span class="hljs-string">"http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&amp;group=test"</span>
</code></pre>
</li>
<li>
<p>Open the Nacos console in your browser</p>
<p>link：<a href="http://127.0.0.1:8848/nacos/">http://127.0.0.1:8848/nacos/</a></p>
</li>
</ul>
<h2>Common property configuration</h2>
<table>
<thead>
<tr>
<th>name</th>
<th>description</th>
<th>option</th>
</tr>
</thead>
<tbody>
<tr>
<td>MODE</td>
<td>cluster/standalone</td>
<td>cluster/standalone default <strong>cluster</strong></td>
</tr>
<tr>
<td>NACOS_SERVERS</td>
<td>nacos cluster address</td>
<td>eg. ip1,ip2,ip3</td>
</tr>
<tr>
<td>PREFER_HOST_MODE</td>
<td>Whether hostname are supported</td>
<td>hostname/ip default <strong>ip</strong></td>
</tr>
<tr>
<td>NACOS_SERVER_PORT</td>
<td>nacos server port</td>
<td>default <strong>8848</strong></td>
</tr>
<tr>
<td>NACOS_SERVER_IP</td>
<td>custom nacos server ip when network was mutil-network</td>
<td></td>
</tr>
<tr>
<td>SPRING_DATASOURCE_PLATFORM</td>
<td>standalone support mysql</td>
<td>mysql / empty default empty</td>
</tr>
<tr>
<td>MYSQL_MASTER_SERVICE_HOST</td>
<td>mysql master host</td>
<td></td>
</tr>
<tr>
<td>MYSQL_MASTER_SERVICE_PORT</td>
<td>mysql master database port</td>
<td>default : <strong>3306</strong></td>
</tr>
<tr>
<td>MYSQL_MASTER_SERVICE_DB_NAME</td>
<td>mysql master database name</td>
<td></td>
</tr>
<tr>
<td>MYSQL_MASTER_SERVICE_USER</td>
<td>username of master database</td>
<td></td>
</tr>
<tr>
<td>MYSQL_MASTER_SERVICE_PASSWORD</td>
<td>password of master database</td>
<td></td>
</tr>
<tr>
<td>MYSQL_SLAVE_SERVICE_HOST</td>
<td>mysql slave host</td>
<td></td>
</tr>
<tr>
<td>MYSQL_SLAVE_SERVICE_PORT</td>
<td>mysql slave database port</td>
<td>default :3306</td>
</tr>
<tr>
<td>MYSQL_DATABASE_NUM</td>
<td>It indicates the number of database</td>
<td>default :2</td>
</tr>
<tr>
<td>JVM_XMS</td>
<td>-Xms</td>
<td>default :2g</td>
</tr>
<tr>
<td>JVM_XMX</td>
<td>-Xmx</td>
<td>default :2g</td>
</tr>
<tr>
<td>JVM_XMN</td>
<td>-Xmn</td>
<td>default :1g</td>
</tr>
<tr>
<td>JVM_MS</td>
<td>-XX:MetaspaceSize</td>
<td>default :128m</td>
</tr>
<tr>
<td>JVM_MMS</td>
<td>-XX:MaxMetaspaceSize</td>
<td>default :320m</td>
</tr>
<tr>
<td>NACOS_DEBUG</td>
<td>enable remote debug</td>
<td>y/n default :n</td>
</tr>
<tr>
<td>TOMCAT_ACCESSLOG_ENABLED</td>
<td>server.tomcat.accesslog.enabled</td>
<td>default :false</td>
</tr>
</tbody>
</table>
<h2>Nacos + Grafana + Prometheus</h2>
<p>Usage reference：<a href="https://nacos.io/zh-cn/docs/monitor-guide.html">Nacos monitor-guide</a></p>
<p><strong>Note</strong>:  When Grafana creates a new data source, the data source address must be <strong><a href="http://prometheus:9090">http://prometheus:9090</a></strong></p>
<h2>Related Projects</h2>
<ul>
<li><a href="https://github.com/alibaba/nacos">Nacos</a></li>
<li><a href="https://github.com/nacos-group/nacos-docker">Nacos Docker</a></li>
</ul>
</div></div></section><footer class="footer-container"><div class="footer-body"><img src="/img/nacos_gray.png"/><div class="cols-container"><div class="col col-12"><h3>Vision</h3><p>By providing an easy-to-use service infrastructure such as dynamic service discovery, service configuration, service sharing and management and etc., Nacos help users better construct, deliver and manage their own service platform, reuse and composite business service faster and deliver value of business innovation more quickly so as to win market for users in the era of cloud native and in all cloud environments, such as private, mixed, or public clouds.</p></div><div class="col col-6"><dl><dt>Documentation</dt><dd><a href="/en-us/docs/what-is-nacos.html" target="_self">Overview</a></dd><dd><a href="/en-us/docs/quick-start.html" target="_self">Quick start</a></dd><dd><a href="/en-us/docs/contributing.html" target="_self">Developer guide</a></dd></dl></div><div class="col col-6"><dl><dt>Resources</dt><dd><a href="/en-us/community/index.html" target="_self">Community</a></dd><dd><a href="https://www.aliyun.com/product/acm?source_type=nacos_pc_20181219" target="_self">Cloud Service ACM</a></dd><dd><a href="https://www.aliyun.com/product/edas?source_type=nacos_pc_20181219" target="_self">Cloud Service EDAS</a></dd><dd><a href="https://www.aliyun.com/product/ahas?source_type=nacos_pc_20190225" target="_self">Cloud Service AHAS</a></dd></dl></div></div><div class="copyright"><span>@ 2018 The Nacos Authors | An Alibaba Middleware (Aliware) Project</span></div></div></footer></div></div>
	<script src="https://f.alicdn.com/react/15.4.1/react-with-addons.min.js"></script>
	<script src="https://f.alicdn.com/react/15.4.1/react-dom.min.js"></script>
	<script>
		window.rootPath = '';
  </script>
	<script src="/build/documentation.js"></script>
</body>
</html>